﻿using rbac.Domain.Entity;
using rbac.Domain.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace rbac.Domain.Impl
{
    public class UserRepository : IUserRepository
    {
        /// <summary>
        /// 上下文
        /// </summary>
        private readonly RbacContext db;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="db"></param>

        public UserRepository(RbacContext db)
        {
            this.db = db;
        }

        public IQueryable<User> GetUsers()
        {
            return db.Users;
        }
        public User? Login(string userName, string pwd)
        {
            return db.Users.FirstOrDefault(c => c.UserName == userName && c.Password == pwd);
        }
    }
}
